package com.itheima.mapper;

import com.itheima.bean.Student;
import com.itheima.bean.Studnet;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {
    // 查询所有
    @Select("select * from student")
    public abstract List<Studnet> selectAll();

    // 返回主键自增
    @Options(useGeneratedKeys = true,keyColumn = "sid", keyProperty = "sid")
    // 新增
    @Insert("insert into student values (#{sid},#{name},#{age})")
    public abstract Integer insert(Student stu);

    // 修改
    @Update("UPDATE student SET NAME=#{name},age=#{age} where sid=#{sid}")
    public abstract Integer update(Student stu);

    // 删除
    @Delete("delete from student where sid=#{sid}")
    public abstract Integer delete(Integer sid);
}
